<?php

namespace app\admin\controller;

use think\facade\Db;
use think\facade\View;

class Index extends AdminBase {
    public function index() {

        $categoryObj = new \app\admin\business\Category();
        $categoryList = $categoryObj->getCategoryList();
//        return show(1, 'test', $categoryList);
        return View::fetch('', [
            'list' => $categoryList
        ]);
    }

    public function welcome() {

        $res = Db::table('jy_info')->withoutField('id,update_time')->find(1);
        $articleCount = (new \app\admin\model\Category())->getArticleCountByCategoryId();
//        return show(1, 'test', $articleCount);
        return View::fetch('', [
            'res' => $res,
            'category' => $articleCount,
            'admin' => session(config('admin.session_admin'))
        ]);
    }
}
